﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 小工具合集
{
    public partial class 低通滤波 : Form
    {
        public 低通滤波()
        {
            InitializeComponent();
        }
        double C;
        double R;

        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                if (radioButton4.Checked == true)
                {
                    R = double.Parse(textBox2.Text) * 1000000;
                }
                else if (radioButton5.Checked == true)
                {
                    R = double.Parse(textBox2.Text) * 1000;
                }
                else
                {
                    R = double.Parse(textBox2.Text);
                }

                if (radioButton1.Checked == true)
                {
                    C = double.Parse(textBox3.Text) / 1000000000000;
                }
                else if (radioButton2.Checked == true)
                {
                    C = double.Parse(textBox3.Text) / 1000000000;
                }
                else
                {
                    C = double.Parse(textBox3.Text) / 1000000;
                }

                double PI = 3.1415926;
                double fc = 1 / (2 * PI * R * C);
                textBox1.Text = fc.ToString("0.00");
            }
            catch
            { }
        }

        private void 低通滤波_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            timer1.Start();
        }
    }
}
